import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ManagerWithdrawVO, ManagerWithdrawForm, ManagerWithdrawQuery } from '@/api/device/managerWithdraw/types';

/**
 * 查询代理商提现记录列表
 * @param query
 * @returns {*}
 */

export const listManagerWithdraw = (query?: ManagerWithdrawQuery): AxiosPromise<ManagerWithdrawVO[]> => {
  return request({
    url: '/device/managerWithdraw/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询代理商提现记录详细
 * @param managerWithdrawId
 */
export const getManagerWithdraw = (managerWithdrawId: string | number): AxiosPromise<ManagerWithdrawVO> => {
  return request({
    url: '/device/managerWithdraw/' + managerWithdrawId,
    method: 'get'
  });
};

/**
 * 审批
 * @param data
 */
export const withdrawAudit = (data: ManagerWithdrawForm) => {
  return request({
    url: '/device/managerWithdraw/audit',
    method: 'post',
    data: data
  });
};

/**
 * 新增代理商提现记录
 * @param data
 */
export const addManagerWithdraw = (data: ManagerWithdrawForm) => {
  return request({
    url: '/device/managerWithdraw',
    method: 'post',
    data: data
  });
};

/**
 * 修改代理商提现记录
 * @param data
 */
export const updateManagerWithdraw = (data: ManagerWithdrawForm) => {
  return request({
    url: '/device/managerWithdraw',
    method: 'put',
    data: data
  });
};

/**
 * 删除代理商提现记录
 * @param managerWithdrawId
 */
export const delManagerWithdraw = (managerWithdrawId: string | number | Array<string | number>) => {
  return request({
    url: '/device/managerWithdraw/' + managerWithdrawId,
    method: 'delete'
  });
};
